package com.example.moblie2021606143cwj0617;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    public MySQLiteOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql="create table worker("+" _id integer primary key autoincrement,"+"name text not null,"+"skill text not null,"+"money integer)";
        db.execSQL(sql);
        ContentValues contentValues=new ContentValues();
        contentValues.put("name","姓名");
        contentValues.put("skill","技能");
        contentValues.put("money","薪酬");
        db.insert("worker",null,contentValues);



    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
